<?php $__env->startSection('content'); ?>

    <!-- domain begin-->
    <div class="domain" id="head_domain" style="padding-top:250px;padding-bottom:120px;">
        <div class="container">
            <div class="row">
                <div class="col-md-8">
                    <div class="row">
                        <form action="<?php echo e(route('user.exchange')); ?>" method="post">
                            <div class="col-md-12">
                                <div class="row mt-5">
                                    <?php echo csrf_field(); ?>
                                    <div class="col-xl-12 col-lg-12">
                                        <?php echo $__env->make('errors.error', \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                                        <?php if(session('whoops')): ?>
                                            <div class="alert alert-danger alert-dismissible">
                                                <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
                                                <?php echo __(session('whoops')); ?>

                                            </div>
                                        <?php endif; ?>
                                        <?php if(session('ok')): ?>
                                            <div class="alert alert-danger alert-dismissible">
                                                <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
                                                <?php echo __(session('ok')); ?>

                                            </div>
                                        <?php endif; ?>
                                    </div>
                                    <div class="col-xl-6 col-lg-6">
                                        <div class="row">
                                            <div class="col-md-12">
                                                <div class="form-group">
                                                    <label><h3><i class="fas fa-arrow-down"></i> <?php echo app('translator')->getFromJson('Send Us'); ?></h3> </label>
                                                    <select name="send_method_id" id="from_currency_id" class="form-control sendMethodCurrency form-control-lg prantoChange">
                                                        <option disabled selected><?php echo app('translator')->getFromJson('Select'); ?></option>
                                                        <?php $__currentLoopData = $buy_at; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                            <option value="<?php echo e($data->id); ?>" data-min="<?php echo e($data->minimum_exchange); ?>" data-max="<?php echo e($data->maximum_exchange); ?>"> <?php echo e($data->name); ?></option>
                                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                    </select>

                                                </div>
                                            </div>
                                            <div class="col-md-12">
                                                <div class="form-group">
                                                    <input type="text" class="form-control form-control-lg" id="sendMan" name="send_amount" value="100">
                                                </div>
                                                <strong class="text-danger sendLimitAmo"><?php echo app('translator')->getFromJson('Exchange Limit'); ?> <span class="sendMinAmo"></span> - <span class="sendMaxAmo"></span></strong><br>

                                            </div>


                                        </div>
                                    </div>

                                    <div class="col-xl-6 col-lg-6">

                                        <div class="row">
                                            <div class="col-md-12">
                                                <div class="form-group">
                                                    <label> <h3> <i class="fa fa-arrow-up"></i> <?php echo app('translator')->getFromJson('You Receive'); ?> </h3> </label>
                                                    <select name="receive_method_id" id="receive_currency_id" class="form-control  form-control-lg receiveMethodCurrency prantoReceiver">
                                                        <option disabled selected><?php echo app('translator')->getFromJson('Select'); ?></option>
                                                        <?php $__currentLoopData = $sell_at; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                            <option value="<?php echo e($data->id); ?>" data-reserve="<?php echo e($data->reserve_amount); ?>"> <?php echo e($data->name); ?> </option>
                                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="col-md-12">
                                                <div class="form-group">
                                                    <input type="text" class="form-control  form-control-lg" name="receive_amount" id="receiveMan"  value="100" readonly>
                                                </div>
                                                <strong class="text-danger reserveMoney"> <?php echo app('translator')->getFromJson('Reserve Amount'); ?> : <span class="totalReserveAmo"></span></strong><br>
                                            </div>
                                        </div>

                                    </div>
                                    <div class="col-md-12 text-center mt-2">
                                        <button type="submit" class="btn btn-info bnt-lg"><?php echo app('translator')->getFromJson('Exchange'); ?></button>
                                    </div>

                                </div>

                            </div>
                        </form>

                        <?php echo $__env->make('partials.reserve', \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                    </div>
                </div>

                <?php echo $__env->make('partials.todays_rate', \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
            </div>
        </div>
    </div>
    <!-- domain end -->




    <!-- dedicated plan begin-->
    <div class="dedicated-plan">
        <div class="container">
            <div class="row justify-content-center">
                <div class="col-xl-8 col-lg-8 text-center">
                    <div class="section-title">
                        <h2><span> <?php echo app('translator')->getFromJson('Pending Orders'); ?>  </span></h2>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-xl-12 col-lg-12">
                    <div class="plan-table">
                        <table class="table">
                            <thead>
                            <tr>
                                <th scope="col"><?php echo app('translator')->getFromJson('USERNAME'); ?> </th>
                                <th scope="col"><?php echo app('translator')->getFromJson('SENT'); ?> </th>
                                <th scope="col"><?php echo app('translator')->getFromJson('RECEIVE'); ?> </th>
                                <th scope="col"><?php echo app('translator')->getFromJson('AMOUNT'); ?> </th>
                                <th scope="col"><?php echo app('translator')->getFromJson('STATUS'); ?> </th>
                            </tr>
                            </thead>
                            <tbody>

                            <?php $__currentLoopData = $pendingOrders; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $order): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr>
                                    <th scope="row"><?php echo e($order->user->username); ?></th>
                                    <td><?php echo e($order->send_method->name); ?></td>
                                    <td><?php echo e($order->receive_method->name); ?></td>
                                    <td><?php echo e($order->send_amount); ?>  <i class="fas fa-exchange-alt"></i>  <?php echo e($order->receive_amount); ?></td>
                                    <td><i class="fa fa-spinner"></i> <?php echo app('translator')->getFromJson('Processing'); ?> </td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                            </tbody>
                        </table>
                    </div>

                    <div class="plan-buttons">
                        <a href="<?php echo e(route('pending-orders')); ?>" target="_blank"><?php echo app('translator')->getFromJson('View All'); ?> </a>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- dedicated plan end -->




    <!-- dedicated plan begin-->
    <div class="dedicated-plan">
        <div class="container">
            <div class="row justify-content-center">
                <div class="col-xl-8 col-lg-8 text-center">
                    <div class="section-title">
                        <h2><span> <?php echo app('translator')->getFromJson('Completed Exchanges'); ?>  </span></h2>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-xl-12 col-lg-12">
                    <div class="plan-table">
                        <table class="table">
                            <thead>
                            <tr>
                                <th scope="col"><?php echo app('translator')->getFromJson('USERNAME'); ?> </th>
                                <th scope="col"><?php echo app('translator')->getFromJson('SENT'); ?> </th>
                                <th scope="col"><?php echo app('translator')->getFromJson('RECEIVE'); ?> </th>
                                <th scope="col"><?php echo app('translator')->getFromJson('AMOUNT'); ?> </th>
                                <th scope="col"><?php echo app('translator')->getFromJson('STATUS'); ?> </th>
                            </tr>
                            </thead>
                            <tbody>

                            <?php $__currentLoopData = $completedExchanges; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $order): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr>
                                    <th scope="row"><?php echo e($order->user->username); ?></th>
                                    <td><?php echo e($order->send_method->name); ?></td>
                                    <td><?php echo e($order->receive_method->name); ?></td>
                                    <td><?php echo e($order->send_amount); ?>  <i class="fas fa-exchange-alt"></i>  <?php echo e($order->receive_amount); ?></td>
                                    <td><i class="fa fa-check"></i> <?php echo app('translator')->getFromJson('Completed'); ?> </td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                            </tbody>
                        </table>
                    </div>

                    <div class="plan-buttons">
                        <a href="<?php echo e(route('completed-exchange')); ?>" target="_blank"><?php echo app('translator')->getFromJson('View All'); ?> </a>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- dedicated plan end -->



    <!-- testimonial begin-->
    <div class="testimonial" style="background-color:#fff">
        <div class="container">
            <div class="row justify-content-center">
                <div class="col-xl-8 col-lg-8 text-center">
                    <div class="section-title">
                        <h4><?php echo e(__($basic->testimonial_h)); ?></h4>
                        <h2><?php echo e(__($basic->testimonial_p)); ?></h2>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-xl-12 col-lg-12">
                    <div class="testimonial-slider">
                        <?php $__currentLoopData = $testimonials; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $testimonial): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <div class="single-testimonial">
                                <div class="d-flex">
                                    <div class="part-img">
                                        <img src=" <?php echo e(asset('assets/images/testimonial/'.$testimonial->image)); ?> " alt="">
                                    </div>
                                    <div class="part-info">
                                        <h3><?php echo e($testimonial->name); ?></h3>
                                        <h4> <?php echo e($testimonial->designation); ?></h4>
                                    </div>
                                </div>
                                <div class="part-text">
                                    <p>“<?php echo e($testimonial->details); ?>”</p>
                                </div>
                            </div>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- testimonial end -->






    <!-- blog begin-->
    <div class="blog-post" style="background-color:#f7fbff;">
        <div class="container">
            <div class="row justify-content-center">
                <div class="col-xl-8 col-lg-8 text-center">
                    <div class="section-title">
                        <h2><?php echo app('translator')->getFromJson('Latest Blog'); ?></h2>
                    </div>
                </div>
            </div>

            <div class="row">
                <?php $__currentLoopData = $blogs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <div class="col-xl-4 col-lg-4 col-md-6">
                        <div class="single-blog">
                            <div class="part-img">
                                <img src="<?php echo e(asset('assets/images/post/'.$data->thumb)); ?>" alt="<?php echo e(__($data->title)); ?>">
                            </div>
                            <div class="part-text">
                                <h3><a href="<?php echo e(route('blog.details',[$data->id, str_slug($data->title)])); ?>"><?php echo e(__( str_limit($data->title,60) )); ?></a></h3>
                                <p><?php echo e(str_limit(strip_tags($data->details),100)); ?></p>
                            </div>
                        </div>
                    </div>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </div>
        </div>
    </div>
    <!-- blog end -->

<?php $__env->stopSection(); ?>


<?php $__env->startSection('script'); ?>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('js'); ?>
    <script type="text/javascript">
        $(document).ready(function () {

            var senderId = $(".prantoChange").val();
            var receiverId = $(".prantoReceiver").val();
            var sendingAmount = $("#sendMan").val();
            $('.sendLimitAmo').hide();
            $('.reserveMoney').hide();


            $('.prantoChange').on('change', function(){
                var senderId = $(".prantoChange").val();
                var receiverId = $(".prantoReceiver").val();
                var sendingAmount = $("#sendMan").val();

                var sendMaxAmo = $('.sendMethodCurrency option:selected').data('max');
                var sendMinAmo = $('.sendMethodCurrency option:selected').data('min');

                $('.sendMaxAmo').text(sendMaxAmo);
                $('.sendMinAmo').text(sendMinAmo);
                $('.sendLimitAmo').show();




                ajaxReq(senderId,receiverId,sendingAmount);
            });


            $('.prantoReceiver').on('change', function(){
                var senderId = $(".prantoChange").val();
                var receiverId = $(".prantoReceiver").val();
                var sendingAmount = $("#sendMan").val();


               var totalReserveAmo =  $('.receiveMethodCurrency option:selected').data('reserve');

                $('.totalReserveAmo').text(totalReserveAmo);
                $('.reserveMoney').show();


                ajaxReq(senderId,receiverId,sendingAmount);
            });



            $('#sendMan').keyup( function(){

                var senderId = $(".prantoChange").val();
                var receiverId = $(".prantoReceiver").val();
                var sendingAmount = $("#sendMan").val();
                if($(this).val() > 0){
                    ajaxReq(senderId,receiverId,sendingAmount);
                }else{
                    alert('Please Insert Valid Number')
                    $('#sendMan').val(1)

                    var senderId = $(".prantoChange").val();
                    var receiverId = $(".prantoReceiver").val();
                    var sendingAmount = $("#sendMan").val();
                    ajaxReq(senderId,receiverId,sendingAmount);
                }
            });

            function ajaxReq(senderId,receiverId,sendingAmount){
                $.ajax({
                    url: "<?php echo e(route('get.rate')); ?>",
                    type: "get",
                    data: {
                        'senderId' : senderId,
                        'receiverId' : receiverId,
                        'sendingAmount' : sendingAmount,

                    } ,
                    success: function (response) {
                        $('#receiveMan').val(response)
                    }
                });
            }



        });
    </script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layout', \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>